package leechapi.main;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Date;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class ProcessingContext {
	
	private Connection conn;
	private Date date = new Date();
	
	private AtomicBoolean workToDo;
	
	private AtomicInteger numPage;
	
	public ProcessingContext() throws Exception {
		Class.forName("org.h2.Driver");
		conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/leech", "sa", "");
		numPage = new AtomicInteger(1);
		workToDo = new AtomicBoolean(true);
	}
	
	public Connection getConnection() {
		return conn;
	}
	
	public void close() throws Exception {
		conn.close();
	}
	
	public Date getDate() {
		return date;
	}

	public AtomicInteger getNumPage() {
		return numPage;
	}

	public void setNumPage(AtomicInteger numPage) {
		this.numPage = numPage;
	}

}
